package com.nineclock.system.feign;

import com.nineclock.common.entity.Result;
import com.nineclock.system.dto.SysCompanyUserDTO;
import com.nineclock.system.dto.SysUserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.awt.color.ICC_Profile;
import java.util.List;

/**
 * @author zhangyan
 * @date 2021/3/31 23:33
 */

@FeignClient("sys-service")
public interface SysUserFeign {
    /**
     * 根据用户名或手机号查询
     * @param username
     * @return
     */
    @GetMapping("/user/query")
    public Result<SysUserDTO> query(@RequestParam("username") String username);

    /**
     * 根据用户ID, 企业ID查询企业员工的基本信息,企业信息,角色信息
     * @param userId
     * @param companyId
     * @return
     */
    @GetMapping("/companyUser/query")
    public Result<List<SysCompanyUserDTO>> queryCompanyUser(
            @RequestParam(value = "userId", required = false) Long userId,
            @RequestParam(value = "companyId", required = false) Long companyId);

    /**
     * 根据员工ID查询员工信息
     * @param companyUserId
     * @return
     */
    @GetMapping("/companyUser/query/{companyUserId}")
    public Result<SysCompanyUserDTO> queryByCompanyUserId(@PathVariable("companyUserId") Long companyUserId);

    /**
     * 查询全部的企业员工
     * @return
     */
    @GetMapping("/companyUser/queryAllUser")
    public Result<List<SysCompanyUserDTO>> queryAllCompanyUser();

    /**
     * 查询企业ID下的所有部门ID
     * @return
     */
    @GetMapping("/organization/department/top")
    public Result<List<Long>> queryDepartmentIds();

    /**
     * 查询指定部门集合下员工的数量
     */
    @GetMapping("/organization/department/membernum")
    public Result<Integer> queryUserCountByDepartmentIds(@RequestParam("departmentIds") List<Long> departmentIds);

    /**
     * 根据员工id获得部门从低到高级别的部门ID数组
     * @param
     * @return
     */
    @GetMapping("/organization/allDepId/{companyUserId}")
    public Result<List<Long>> queryDepartmentsByUserId(@PathVariable("companyUserId") Long companyUserId);

    /**
     * 根据企业ID查询企业的主管理员信息
     * @param companyId
     * @return
     */
    @GetMapping("/companyUser/queryAdminByCompanyId")
    public Result<SysCompanyUserDTO> queryAdminByCompanyId(@RequestParam(value = "companyId", required = false)Long companyId);


}